
$(document).ready(function() {
		invalidHandler: function(form, validator) {
						  var errors = validator.numberOfInvalids();
						  if (errors) {
								for (var i=0; i < validator.errorList.length; i++){
										//HERE YOU COULD PRINT OUT ALL YOUR ERRORS TO A DIV ETC
								}
							return false;
						  }
		},
		success:function(label){
			label.html("<img src='./images/right.jpg' height='10' width='10' alt='Valid'>");
		},
		errorPlacement: function(error, element) { 
			error.insertAfter(element);
			//generateTooltips();
		},
		
		//override default onfocusout of validation plugin
		onfocusout: function(element) {
						if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
							this.element(element);
						}			
		},
		highlight: function(element, errorClass) {
			 $(element).fadeOut("fast", function() {
			   $(element).fadeIn("fast")
			 })
		}
	});

		//function to generate tooltips

		function generateTooltips() {

		  //make sure tool tip is enabled for any new error label

			$("img[id*='error']").tooltip({
				showURL: false,
				opacity: 0.99,
				fade: 150,
				positionRight: true,
				bodyHandler: function() {
				return $("#"+this.id).attr("hovertext");
					}
			});

			//make sure tool tip is enabled for any new valid label

			$("img[src*='tick.gif']").tooltip({
				showURL: false,
					bodyHandler: function() {
						return "OK";
					}
			});
		}